package com.sitepoint;

import java.math.BigInteger;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

    public class helloworld extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        int[] input;
        input = new int[2];
        int selection=0;
        helloworld work = new helloworld();
        //Make a new text view passing Activity object
        TextView tv = new TextView(this);
        //Set a text into view
        tv.setText("Please pick your selection"+"\n1 - Addition"+"\n2 - Subtractor"+"\n3 - Multiplication"+"\n4 - Division");
        //set the view into activity view container
        setContentView(tv);
        work.calculater(input[0], input[1], selection);
        setContentView(tv);
    }
    public helloworld(){
    }
    public int calculater(int input1, int input2, int selection){
    	int output = 0;
    	helloworld cal = new helloworld();
    	if(selection == 1)
    	{
    		cal.sum(input1,input2);
    	}
    	return output;
    }
    public int sum(int add1, int add2){
    	int sumResult = 0;
    	int[] sumCal;
    	sumCal = new int[2];
    	sumCal[0] = add1;
    	sumCal[1] = add2;
    	sumResult = sumCal[0]+sumCal[1];
    	return sumResult;
    }
    public int subtract(int sub1, int sub2){
    	int subResult = 0;
    	int[] subCal;
    	subCal = new int[2];
    	subCal[0] = sub1;
    	subCal[1] = sub2;
    	subResult = subCal[0] - subCal[1];
    	return subResult;
    }
    public int multiple(int time1, int time2){
    	int timeResult = 0;
    	int[] timeCal;
    	timeCal = new int[2];
    	timeCal[0] = time1;
    	timeCal[1] = time2;
    	timeResult = timeCal[0] * timeCal[1];
    	return timeResult;
    }
    public int devide(int dev1, int dev2){
    	int devResult = 0;
    	helloworld h = new helloworld();
    	int bigFat = h.gcdThing(dev1, dev2);
    	int[] devCal;
    	devCal = new int[2];
    	if(devCal[1] > devCal[0] && devCal[0] > 0 || devCal[1] < 0){
    	devResult = (devCal[1]/bigFat)/(devCal[0]/bigFat);
    	System.out.println("Result"+devResult);
    	}
    	else if(devCal[1] < devCal[0] && devCal[1] >0 || devCal[0] < 0){
    	System.out.println("the reminder is" + devCal[1]/bigFat);
    	}
    	return devResult;
    }
    public int gcdThing(int a, int b) {
        BigInteger b1 = new BigInteger(""+a);
        BigInteger b2 = new BigInteger(""+b);
        BigInteger gcd = b1.gcd(b2);
        return gcd.intValue();
    }
}

